<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子管理 - DNF福利盒子</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f2f2f7;
            margin: 0;
            padding: 0;
            height: 100vh;
            overflow: hidden;
        }
        .status-bar {
            height: 44px;
            background: rgba(0, 0, 0, 0.8);
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            font-size: 14px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }
        .nav-bar {
            height: 44px;
            background: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            border-bottom: 1px solid #e5e5ea;
            position: fixed;
            top: 44px;
            left: 0;
            right: 0;
            z-index: 1000;
        }
        .content {
            padding: 88px 16px 83px;
            height: calc(100vh - 127px);
            overflow-y: auto;
        }
        .tab-bar {
            height: 83px;
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(20px);
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid #e5e5ea;
            z-index: 1000;
        }
        .tab-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            color: #8e8e93;
            font-size: 10px;
        }
        .tab-item.active {
            color: #007aff;
        }
        .tab-item i {
            font-size: 22px;
        }
        .box-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .box-item {
            background: white;
            border-radius: 12px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            border: 2px solid transparent;
            transition: all 0.2s ease;
        }
        .box-item.active {
            border-color: #007aff;
            background: #f0f7ff;
        }
        .box-icon {
            width: 48px;
            height: 48px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 20px;
        }
        .box-info {
            flex: 1;
        }
        .box-name {
            font-size: 16px;
            font-weight: 600;
            color: #1d1d1f;
            margin-bottom: 4px;
        }
        .box-status {
            font-size: 12px;
            color: #8e8e93;
        }
        .box-actions {
            display: flex;
            gap: 12px;
        }
        .action-btn {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f2f2f7;
            color: #007aff;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .action-btn:hover {
            background: #007aff;
            color: white;
        }
        .add-box-btn {
            background: #007aff;
            color: white;
            padding: 16px;
            border-radius: 12px;
            text-align: center;
            font-weight: 600;
            margin-top: 20px;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
        }
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2000;
        }
        .modal-content {
            background: white;
            border-radius: 16px;
            padding: 24px;
            width: 300px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        }
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 16px;
            text-align: center;
        }
        .input-field {
            width: 100%;
            padding: 12px;
            border: 1px solid #e5e5ea;
            border-radius: 8px;
            font-size: 16px;
            margin-bottom: 16px;
        }
        .modal-actions {
            display: flex;
            gap: 12px;
        }
        .btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: 600;
            text-align: center;
            cursor: pointer;
        }
        .btn-cancel {
            background: #f2f2f7;
            color: #1d1d1f;
            border: none;
        }
        .btn-confirm {
            background: #007aff;
            color: white;
            border: none;
        }
    </style>
</head>
<body>
    <!-- 状态栏 -->
    <div class="status-bar">
        <span>12:34</span>
        <span>📶 5G</span>
    </div>

    <!-- 导航栏 -->
    <div class="nav-bar">
        <span>盒子管理</span>
        <span></span>
    </div>

    <!-- 内容区域 -->
    <div class="content">
        <div class="box-list">
            <!-- 主号盒子 -->
            <div class="box-item active">
                <div class="box-icon">
                    <i class="fas fa-crown"></i>
                </div>
                <div class="box-info">
                    <div class="box-name">主号盒子</div>
                    <div class="box-status">已登录 · 默认盒子</div>
                </div>
                <div class="box-actions">
                    <div class="action-btn" onclick="renameBox('主号盒子')">
                        <i class="fas fa-edit"></i>
                    </div>
                </div>
            </div>

            <!-- 小号盒子1 -->
            <div class="box-item">
                <div class="box-icon">
                    <i class="fas fa-cube"></i>
                </div>
                <div class="box-info">
                    <div class="box-name">小号盒子1</div>
                    <div class="box-status">已登录 · 上次领取: 2小时前</div>
                </div>
                <div class="box-actions">
                    <div class="action-btn" onclick="renameBox('小号盒子1')">
                        <i class="fas fa-edit"></i>
                    </div>
                    <div class="action-btn" onclick="deleteBox('小号盒子1')">
                        <i class="fas fa-trash"></i>
                    </div>
                </div>
            </div>

            <!-- 小号盒子2 -->
            <div class="box-item">
                <div class="box-icon">
                    <i class="fas fa-cube"></i>
                </div>
                <div class="box-info">
                    <div class="box-name">小号盒子2</div>
                    <div class="box-status">未登录</div>
                </div>
                <div class="box-actions">
                    <div class="action-btn" onclick="renameBox('小号盒子2')">
                        <i class="fas fa-edit"></i>
                    </div>
                    <div class="action-btn" onclick="deleteBox('小号盒子2')">
                        <i class="fas fa-trash"></i>
                    </div>
                </div>
            </div>

            <!-- 添加盒子按钮 -->
            <div class="add-box-btn" onclick="showAddBoxModal()">
                <i class="fas fa-plus"></i> 添加新盒子
            </div>
        </div>
    </div>

    <!-- 底部标签栏 -->
    <div class="tab-bar">
        <div class="tab-item">
            <i class="fas fa-gift"></i>
            <span>福利</span>
        </div>
        <div class="tab-item active">
            <i class="fas fa-cubes"></i>
            <span>盒子</span>
        </div>
        <div class="tab-item">
            <i class="fas fa-bolt"></i>
            <span>批量</span>
        </div>
        <div class="tab-item">
            <i class="fas fa-cog"></i>
            <span>设置</span>
        </div>
    </div>

    <!-- 添加盒子模态框 -->
    <div class="modal" id="addBoxModal">
        <div class="modal-content">
            <div class="modal-title">添加新盒子</div>
            <input type="text" class="input-field" id="boxNameInput" placeholder="请输入盒子名称">
            <div class="modal-actions">
                <div class="btn btn-cancel" onclick="hideAddBoxModal()">取消</div>
                <div class="btn btn-confirm" onclick="addNewBox()">确认</div>
            </div>
        </div>
    </div>

    <!-- 重命名模态框 -->
    <div class="modal" id="renameBoxModal">
        <div class="modal-content">
            <div class="modal-title">重命名盒子</div>
            <input type="text" class="input-field" id="renameBoxInput" placeholder="请输入新名称">
            <div class="modal-actions">
                <div class="btn btn-cancel" onclick="hideRenameBoxModal()">取消</div>
                <div class="btn btn-confirm" onclick="confirmRename()">确认</div>
            </div>
        </div>
    </div>

    <!-- 删除确认模态框 -->
    <div class="modal" id="deleteConfirmModal">
        <div class="modal-content">
            <div class="modal-title">确认删除</div>
            <p style="text-align: center; margin-bottom: 16px; color: #8e8e93;">
                确定要删除这个盒子吗？此操作不可恢复。
            </p>
            <div class="modal-actions">
                <div class="btn btn-cancel" onclick="hideDeleteConfirmModal()">取消</div>
                <div class="btn btn-confirm" onclick="confirmDelete()" style="background: #ff3b30;">删除</div>
            </div>
        </div>
    </div>

    <script>
        let currentBoxToRename = '';
        let currentBoxToDelete = '';

        function showAddBoxModal() {
            document.getElementById('addBoxModal').style.display = 'flex';
            document.getElementById('boxNameInput').value = '';
            document.getElementById('boxNameInput').focus();
        }

        function hideAddBoxModal() {
            document.getElementById('addBoxModal').style.display = 'none';
        }

        function showRenameBoxModal(boxName) {
            currentBoxToRename = boxName;
            document.getElementById('renameBoxModal').style.display = 'flex';
            document.getElementById('renameBoxInput').value = boxName;
            document.getElementById('renameBoxInput').focus();
        }

        function hideRenameBoxModal() {
            document.getElementById('renameBoxModal').style.display = 'none';
        }

        function showDeleteConfirmModal(boxName) {
            currentBoxToDelete = boxName;
            document.getElementById('deleteConfirmModal').style.display = 'flex';
        }

        function hideDeleteConfirmModal() {
            document.getElementById('deleteConfirmModal').style.display = 'none';
        }

        function addNewBox() {
            const boxName = document.getElementById('boxNameInput').value.trim();
            if (boxName) {
                alert(`添加新盒子: ${boxName}`);
                hideAddBoxModal();
            }
        }

        function renameBox(boxName) {
            showRenameBoxModal(boxName);
        }

        function confirmRename() {
            const newName = document.getElementById('renameBoxInput').value.trim();
            if (newName) {
                alert(`将盒子 ${currentBoxToRename} 重命名为 ${newName}`);
                hideRenameBoxModal();
            }
        }

        function deleteBox(boxName) {
            showDeleteConfirmModal(boxName);
        }

        function confirmDelete() {
            alert(`删除盒子: ${currentBoxToDelete}`);
            hideDeleteConfirmModal();
        }

        // 点击模态框背景关闭
        document.querySelectorAll('.modal').forEach(modal => {
            modal.addEventListener('click', (e) => {
                if (e.target === modal) {
                    modal.style.display = 'none';
                }
            });
        });

        // 回车键确认
        document.addEventListener('keydown', (e) => {
            if (e.key === 'Enter') {
                if (document.getElementById('addBoxModal').style.display === 'flex') {
                    addNewBox();
                } else if (document.getElementById('renameBoxModal').style.display === 'flex') {
                    confirmRename();
                }
            }
        });
    </script>
</body>
</html>